import 'package:flutter/material.dart';

import '../../function/main_tabbar/widgets/main_page.dart';
import '../../function/meal_list_page/widgets/meal_list_page.dart';
import '../../function/fliter_page/widgets/filter_page.dart';
import '../../function/meal_detail_page/widgets/meal_detail_page.dart';

class YSHRouter {
  static const String initialRoute = YSHMainPage.routeName;

  static final Map<String, WidgetBuilder> routes = {
    YSHMainPage.routeName: (_) => const YSHMainPage(),
    YSHMealListPage.routeName: (_) => const YSHMealListPage(),
    YSHMealDetailPage.routeName: (_) => const YSHMealDetailPage(),
  };

// 自己扩展
  static final RouteFactory? generateRoute = (settings) {
    if (settings.name == YSHFilterPage.routeName) {
      return MaterialPageRoute(
          builder: (_) {
            return YSHFilterPage();
          },
          fullscreenDialog: true);
    }
    return null;
  };

  static final RouteFactory? unknownRoute = (settings) {
    return null;
  };

  static pop(context) {
    Navigator.pop(context);
  }
}
